<!doctype html>
<html lang="zh-cmn-Hans">
<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
  <title>如何在 Angular 中使用 - Vditor</title>
  <meta name="robots" content="index,follow,archive">
  <meta name="description"
        content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
  <meta name="copyright" content="B3log"/>
  <link rel="canonical" href="https://vditor.b3log.org">
  <link rel="apple-touch-icon" href="//static.b3log.org/images/brand/vditor-128.png">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta http-equiv="Window-target" content="_top"/>
  <link rel="icon" type="image/png" href="//static.b3log.org/images/brand/vditor-128.png"/>
  <link rel="shortcut icon" type="image/x-icon" href="//static.b3log.org/images/brand/vditor-512.png"/>
  <link type="text/css" rel="stylesheet" href="//static.b3log.org/css/base.css" charset="utf-8"/>

  <meta property="og:locale" content="zh_CN"/>
  <meta property="og:title" content="如何在 Angular 中使用 - Vditor"/>
  <meta property="og:description"
        content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
  <meta property="og:image" content="https://static.b3log.org/images/brand/vditor-128.png"/>
  <meta property="og:url" content="https://vditor.b3log.org"/>
  <meta property="og:site_name" content="B3log"/>
  <meta name="twitter:card" content="summary_large_image"/>
  <meta name="twitter:description"
        content="Vditor 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、五线谱、多媒体、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染"/>
  <meta name="twitter:title" content="如何在 Angular 中使用 - Vditor"/>
  <meta name="twitter:image" content="https://static.b3log.org/images/brand/vditor-128.png"/>
  <meta name="twitter:url" content="https://vditor.b3log.org"/>
  <meta name="twitter:site" content="@b3logos"/>
  <meta name="twitter:creator" content="@b3logos"/>
  <base href="/">
  <script src="//vditor.b3log.org/vditor.js?v1.0.0" defer></script>
</head>
<body>
<div class="header fn-clear">
  <a class="header-logo" href="https://vditor.b3log.org">
    <img src="//static.b3log.org/images/brand/vditor-128.png">
    <h1>Vditor</h1>
  </a>
  <div class="fn-clear">
    <a class="header-a" href="https://hacpai.com/tag/vditor" target="_blank">社区</a>
    <a class="header-a header-red" target="_blank" href="https://hacpai.com/article/1549638745630">API</a>
    <a class="header-a header-green current" href="../../index.html">Demo</a>
    <a class="header-a header-yellow" href="https://hacpai.com/sponsor" target="_blank">成为赞助者</a>
  </div>
</div>
<div class="wrapper">
  <div class="fn-50"></div>
  <app-root></app-root>
  <div id="vditorDemoCode" class="vditor-reset">
    <pre><code class="typescript">import {Component, OnInit} from '@angular/core';
import Vditor from 'vditor';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
})

export class AppComponent implements OnInit{
  vditor: Vditor;

  ngOnInit(): void {
    this.vditor = new Vditor('vditor', {
      toolbarConfig: {
        pin: true,
      },
      cache: {
        enable: false,
      },
      after: () => {
        this.vditor.setValue('Hello, Vditor + Angular!');
      }
    });
  }
}
</code></pre>
  </div>
  <div class="fn-100"></div>
  <div class="fn-clear">
    <h2 class="fn-left">参与讨论</h2>
    <span class="fn-right" style="line-height: 36px" id="commentCnt"></span>
  </div>
  <div class="fn-50"></div>
  <div id="vditorComments"></div>
  <div class="fn-100"></div>
</div>
<div class="footer">
  <div class="wrapper fn-clear">
    <a href="https://b3log.org">首页</a> &nbsp; &nbsp;
    <a href="https://hacpai.com" target="_blank">社区</a> &nbsp; &nbsp;
    <a href="https://b3log.org/brand-marking.html">品牌标识</a> &nbsp; &nbsp;
    <a href="https://hacpai.com/sponsor" target="_blank">成为赞助者</a>
    <div class="fn-right">
      © 2010-present <a href="https://b3log.org">B3log 开源</a>旗下云南链滴科技有限公司
    </div>
  </div>
</div>
</body>
</html>
